<template>
  <div>
    <router-link
      :to="{
        name: 'header',
      }"
      >点击</router-link
    >
    <router-link
      :to="{
        name: 'body',
      }"
      >点击切换到页面上</router-link
    >
    <transition name="one">
      <router-view></router-view>
    </transition>
  </div>
</template>

<script>
// 引入组件
export default {
  name: "App",
};
</script>

<style>
.one-enter {
  opacity: 0;
}
.one-enter-active {
  transition: all 1s ease;
}
.one-enter-to {
  opacity: 1;
}

.one-leave {
  opacity: 1;
}
.one-leave-active {
  transition: all 1s ease;
}
.one-leave-to {
  opacity: 0;
}

/* 改变被删除元素不占空间的时候，缓动效果  */
.one-move {
  transition: all 0.5s linear;
}

/* 被删除的元素控制不占用空间 */
.one-leave-active {
  position: absolute;
}
</style>
